<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title><?php echo $this->escape($this->pageTitle);?> : EcartAdministrator</title>
        <link rel="icon" href="<?php echo $this->skinUrl('favicon.ico') ?>" type="image/x-icon" />
        <link rel="shortcut icon" href="<?php echo $this->skinUrl('favicon.ico') ?>" type="image/x-icon" />

        {{headStyle}}
        {{headLink}}
        <script type="text/javascript">
        var Ecart = {
            baseUrl     : "<?php echo $this->baseUrl ?>",
            secureUrl   : "<?php echo Ecart::config('core/backend/ssl') ? $this->secureUrl : $this->baseUrl ?>",
            adminUrl    : '<?php echo $this->adminUrl ?>',
            skinUrl     : '<?php echo $this->skinUrl() ?>',
            locale      : '<?php echo Ecart_Locale::getLocale()->toString() ?>',
            language    : '<?php echo Ecart_Locale::getLanguageId() ?>',
            languages   : <?php echo Zend_Json_Encoder::encode(Ecart_Collect_Language::collect()) ?>,
            locales     : <?php echo Zend_Json_Encoder::encode(
                Ecart::single('locale/language')->select()->fetchAssoc()
            ) ?>
        };
        </script>
        {{headScript}}
        <script type="text/javascript">
        Ext.namespace('Ecart');
        Ext.BLANK_IMAGE_URL = Ecart.secureUrl + '/js/extjs/resources/images/default/s.gif';
        </script>

        <?php
        $this->headLink()
            ->setProxy('ecart_core')
            ->offsetSetStylesheet(-100, 'layout.css')
            ->offsetSetStylesheet(-98, 'navigation.css')
            ->offsetSetStylesheet(-96, 'elements.css')
            ->offsetSetStylesheet(-94, 'tabs.css')
            ->offsetSetStylesheet(-92, 'js/extjs/resources/css/ext-all.css')
            ->offsetSetStylesheet(-90, 'js/extjs/resources/css/xtheme-gray.css')
            ->offsetSetStylesheet(-88, 'js/extjs/examples/ux/css/ux-all.css')
            ->offsetSetStylesheet(-86, 'js/extjs-ux/grid/RowActions.css')
            ->offsetSetStylesheet(-84, 'js/extjs-ux/maximbg.treegrid/css/TreeGrid.css')
            ->offsetSetStylesheet(-82, 'js/extjs-ecart/resources/css/ext-ecart-all.css')
            ->offsetSetStylesheet(-80, 'js/jquery/datepicker/ui.datepicker.css');

        $this->headScript()
            ->setProxy('ecart_core')
            ->offsetSetFile(-100, 'js/jquery/jquery-1.4.min.js')
            ->offsetSetFile(-98, 'js/extjs/adapter/jquery/ext-jquery-adapter.js')
            ->offsetSetFile(-96, 'js/extjs/ext-all-debug.js')
            ->offsetSetFile(-94, 'js/extjs/examples/ux/ux-all-debug.js')
            ->offsetSetFile(-92, 'js/ecart/admin/core/script.js')
            ->offsetSetFile(-90, 'js/ecart/admin/core/ajax.js')
            ->offsetSetFile(-78, 'js/ecart/admin/core/translate.js');

        $this->headScript()
            ->setProxy('ecart_core')
            ->offsetSetFile(-70, 'js/extjs-ux/maximbg.treegrid/source/NS.js')
            ->offsetSetFile(-68, 'js/extjs-ux/maximbg.treegrid/source/AbstractTreeStore.js')
            ->offsetSetFile(-66, 'js/extjs-ux/maximbg.treegrid/source/AdjacencyListStore.js')
            ->offsetSetFile(-64, 'js/extjs-ux/grid/RowActions.js');

        //$this->headScript()->appendFile('js/extjs-ecart/ext-ecart-all.js');
        $this->headScript()
            ->setProxy('ecart_extjs')
            ->offsetSetFile(-50, 'js/extjs-ecart/src/core/core/Ecart-more.js')
            ->offsetSetFile(-48, 'js/extjs-ecart/src/dd/GridRow.js')
            ->offsetSetFile(-46, 'js/extjs-ecart/src/data/NestedSetStore.js')
            ->offsetSetFile(-44, 'js/extjs-ecart/src/widgets/PagingToolbar.js')
            ->offsetSetFile(-42, 'js/extjs-ecart/src/widgets/Panel.js')
            ->offsetSetFile(-40, 'js/extjs-ecart/src/widgets/Window.js')
            ->offsetSetFile(-38, 'js/extjs-ecart/src/widgets/form/BasicForm.js')
            ->offsetSetFile(-36, 'js/extjs-ecart/src/widgets/form/Form.js')
            ->offsetSetFile(-34, 'js/extjs-ecart/src/widgets/form/Field.js')
            ->offsetSetFile(-33, 'js/extjs-ecart/src/widgets/form/DateField.js')
            ->offsetSetFile(-32, 'js/extjs-ecart/src/widgets/form/HtmlEditor.js')
            ->offsetSetFile(-30, 'js/extjs-ecart/src/widgets/form/LanguageSet.js')
            ->offsetSetFile(-28, 'js/extjs-ecart/src/widgets/grid/NestedView.js')
            ->offsetSetFile(-26, 'js/extjs-ecart/src/widgets/grid/GridPanel.js')
            ->offsetSetFile(-24, 'js/extjs-ecart/src/widgets/grid/EditorGrid.js')
            ->offsetSetFile(-22, 'js/extjs-ecart/src/widgets/grid/GridTree.js')
            ->offsetSetFile(-20, 'js/extjs-ecart/src/widgets/grid/CheckColumn.js')
            ->offsetSetFile(-18, 'js/extjs-ecart/src/widgets/grid/RadioColumn.js')
            ->offsetSetFile(-16, 'js/extjs-ecart/src/widgets/DelayedLoader.js');

        $locale = Ecart_Locale::getLocale()->toString();

        $this->headScript()->offsetSetFile(-75, 'js/ecart/admin/translation/'. $locale .'/core.js');

        if (file_exists('js/extjs/src/locale/ext-lang-' . $locale . '.js')) {
            $this->headScript()->appendFile(
                'js/extjs/src/locale/ext-lang-' . $locale . '.js'
            );
        } elseif (file_exists('js/extjs/src/locale/ext-lang-' . Ecart_Locale::getLocale()->getLanguage() . '.js')) {
            $this->headScript()->appendFile(
                'js/extjs/src/locale/ext-lang-' . Ecart_Locale::getLocale()->getLanguage() . '.js'
            );
        }
        ?>

        <?php $this->addFilter('Placeholder') ?>
    </head>
    <body>
        <div class="header-container">
            <div class="header">
                <a href="<?php echo $this->href('index')?>" id="logo">
                    <?php echo $this->image('logo.gif', 'alt="' . Ecart::config()->core->company->name . '"'); ?>
                </a>
                <?php echo $this->box('admin/greeting')->toHtml() ?>
            </div>
        </div>

        <div class="navigation-container">
            <div class="navigation">
                <?php echo $this->menu() ?>
            </div>
        </div>

        <div class="middle-container">
            <div class="middle <?php echo $this->columnMode ? $this->columnMode : 'one-column' ?>">
                <div class="page-head">
                    <h3 class="left green-header">
                        <?php echo $this->pageTitle;?>
                    </h3>
                    <?php echo $this->buttons(); ?>
                </div>

                <div class="columns-container">
                    <div class="col-main">
                        <div id="inside-box">
                        <?php echo $this->message() ?>
                        <?php echo $this->layout()->content;?>
                        </div>
                    </div>
                    <?php if ($this->columnMode): ?>
                        <div class="col-left">
                            <?php echo $this->tabs ?>
                        </div>
                    <?php endif; ?>
                </div>

            </div>
        </div>

        <div class="footer-container">
            <div class="footer">
                <p class="legality">Copyright &copy; <?php echo Ecart_Date::now()->toPhpString('Y') ?> Ecart |</p>
                <p class="locale">
                    <?php echo $this->translate('admin')->__('Interface locale') ?>:
                    <?php $currentLocaleCode = Ecart_Locale::getLocale()->toString();
                    echo $this->formSelect('interface_locale', $currentLocaleCode, null, Ecart_Locale::getAdminLocales());
                    ?>
                </p>
                <p class="bugs"><?php echo $this->translate('core')->__("Report any %s you've found", "<a href='http://code.google.com/p/ecartcommerce/issues/entry' onclick='window.open(this.href); return false;' title='" . $this->translate('core')->__('Report') . "'>" . $this->translate('core')->__('Bugs or Issues') . "</a>") ?></p>
                <p class="powered"><?php echo $this->translate('core')->__("Powered by %s v. %s", "<a href='http://www.ecartcommerce.com' onclick='window.open(this.href); return false;' title='Ecart'>Ecart</a>", Ecart::app()->getVersion()) ?></p>
            </div>
        </div>

        <script type="text/javascript">
        $('#interface_locale').change(function() {
            window.location.href = Ecart.getUrl('/locale_language/change/new_locale/' + this.value);
        });
        </script>
    </body>
</html>